﻿//#define _CRT_SECURE_NO_WARNINGS  1
////一定要动手，例子不管多么简单，建议至少自己手敲一遍看看是否理解了里头的细枝末节。
////一定要学会思考，思考为什么要这样，而不是那样。还要举一反三地思考
//#include<string>
//#include<iostream>
//using namespace std;
////class Animal {
////public:
////	virtual void func() = 0;
////	Animal()
////	{
////		cout << "animal 构造函数调用" << endl;
////	}
////	//虚析构函数
////	virtual ~Animal() = 0;
////	
////};
////	Animal::~Animal()
////	{
////		cout << "animal 析构函数调用" << endl;
////	}
////class Cat :public Animal {
////public:
////	string* _name;
////public:
////	Cat(string name)
////	{
////		cout << "Cat构造函数调用" << endl;
////		_name = new string(name);
////	}
////	virtual void func()
////	{
////		cout <<*_name<< "   小猫在叫喵喵喵" << endl;
////	}
////	~Cat()
////	{
////		cout << "Cat 析构函数调用" << endl;
////		if (_name != nullptr)
////		{
////			delete _name;
////			_name = NULL;
////		}
////	}
////};
////void test()
////{
////	Animal* animal = new Cat("Tom");
////	animal->func();
////	delete animal;
////}
////int main()
////{
////	test();
////	return 0;
////}
//class A
//{
//public:
//    int i;
//    virtual void Print() { } // 虚函数
//};
//
//class B
//{
//public:
//    int n;
//    void Print() { }
//};
//
//int main()
//{
//    cout << sizeof(A) << "," << sizeof(B);
//    return 0;
//}